"syntax manual "自动语法高亮
"winpos 5 5          " 设定窗口位置  
"set lines=40 columns= cq    " 设定窗口大小  
"set nu              " 显示行号  
set rnu
"自动切换行号显示模式
"set number
"augroup numbertoggle
"  autocmd!
"  autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu   | endif
"  autocmd BufLeave,FocusLost,InsertEnter,WinLeave   * if &nu                  | set nornu | endif
"augroup END
set hidden
set cmdheight=2
set nowritebackup
set shortmess+=c
set ruler           " 显示标尺  
set showcmd         " 输入的命令显示出来，看的清楚些  
"set relativenumber  " 设置相对行号
set foldenable      " 允许折叠  
set foldmethod=indent   " 缩进折叠  
set encoding=utf-8
set timeoutlen=1000
set ttimeoutlen=0
" 设置配色方案
set termguicolors
if has('gui_running')
  set background=dark
  colorscheme default
else
  set background=dark
  colorscheme gruvbox 
endif
" 设置python的版本
set pyxversion=3
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
"set fileencoding=utf-8"
"set autowrite
set guioptions-=T           " 隐藏工具栏
set guioptions-=m           " 隐藏菜单栏
"set cursorcolumn  
set cursorline
" 去掉输入错误的提示声音
set noeb
" 在处理未保存或只读文件的时候，弹出确认
set confirm
" 自动缩进
set cindent
set formatoptions+=j
" Tab键的宽度
set tabstop=4
" 统一缩进为4
set softtabstop=4
set shiftwidth=4
" 不要用空格代替制表符
set noexpandtab
" 在行和段开始处使用制表符
set smarttab 
" 历史记录数
set history=500
"用浅色高亮当前行"
"autocmd InsertEnter * se nocul
"autocmd InsertLeave * se cul
"搜索忽略大小写
set ignorecase
"搜索逐字符高亮
set hlsearch
set incsearch
set magic
set path+=**
set visualbell
"set virtualedit=block
"行内替换
"set gdefault
"编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"语言设置
"set langmenu=zh_CN.UTF-8
set helplang=cn
set synmaxcol=500
set guioptions-=e " Use showtabline in gui vim
set sessionoptions+=tabpages,globals " store tabpages and globals in session
" Vim Directories {{{
" ---------------
set undofile
if ! has('nvim')
	set swapfile nobackup
	set directory=$VIM_DATA_PATH/swap//
	set undodir=$VIM_DATA_PATH/undo//
	set backupdir=$VIM_DATA_PATH/backup/
	set viewdir=$VIM_DATA_PATH/view/
	set spellfile=$VIM_DATA_PATH/spell/en.utf-8.add
endif

augroup user_persistent_undo
	autocmd!
	au BufWritePre /tmp/*          setlocal noundofile
	au BufWritePre *.tmp           setlocal noundofile
	au BufWritePre *.bak           setlocal noundofile
	au BufWritePre COMMIT_EDITMSG  setlocal noundofile noswapfile
	au BufWritePre MERGE_MSG       setlocal noundofile noswapfile
augroup END

" path to the chrome or the command to open chrome(or other modern browsers)
let g:python3_host_prog = '/usr/bin/python3'

""设定文件类型
au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *.yaml set filetype=yaml
""默认回到上次编辑的地方
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
let g:loaded_matchparen        = 1
